﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using FisheryPlatform.Bussiness.ShareCode;

namespace FisheryPlatform.Web.Admin.Modules.Layer
{
    public partial class PopupLayer : System.Web.UI.UserControl
    {
        private DataClassEnum dataClass = DataClassEnum.Fish;

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
        }

        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            InitData();
        }

        private void InitData()
        {
            switch (DataType.ToLower().Trim())
            {
                case "area": dataClass = DataClassEnum.Location; break;
                case "cate": dataClass = DataClassEnum.Fish; break;
            }
        }

        /// <summary>
        /// 数据源类型 Area Cate
        /// </summary>
        public string DataType
        {
            get;
            set;
        }

        public int BoxSize
        {
            get;
            set;
        }

        public string SelectedItemIds
        {
            get { return this.txt_SaveIds_pl.Value; }
            set { this.txt_SaveIds_pl.Value = value; }
        }

        public string SelectedItemNames
        {
            get
            {
                if (string.IsNullOrEmpty(SelectedItemIds)) return "";
                return DataDictionary.Instance.GetShareCode(long.Parse(SelectedItemIds), dataClass).Name;
            }
        }

        public string SaveSelectedItemsEleId
        {
            get
            {
                return this.txt_SaveIds_pl.ClientID;
            }
        }
    }
}